﻿@model ORM.Areas.Admin.ViewModels.ManageCategories.InsertModelCategoryViewModel
@Html.ValidationSummary(true, ValidationMessages.Summary)
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>

<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div class="content-box">
    <div class="content-box-header">
        <h3>
            Model Category information</h3>
    </div>
    <div class="content-box-content">
        @using (Html.BeginForm())
        {
            @Html.HiddenFor(m => m.Model.Id)
            <div class="input">
                <p class="required">
                    @Html.LabelFor(m => m.Model.Name)
                    @Html.TextBoxFor(m => m.Model.Name, new { @class = "text-input small-input" })
                    @Html.ValidationMessageFor(m => m.Model.Name)
                    
                </p>
                <p >
                    @Html.LabelFor(m => m.Model.Description)
                    @Html.TextBoxFor(m => m.Model.Description, new { @class = "text-input small-input" })
                    @Html.ValidationMessageFor(m => m.Model.Name)
                    
                </p>
                

                <p>                    
                    Nhà sản xuất :
                    @Html.DropDownListFor(m => m.Model.ManufacturerId, (IEnumerable<SelectListItem>)(ViewBag.Manufacturer), new { id = "ManufacturerId" })
                    @* @Html.DropDownList("Manufacturer", "----Chọn nhà sản xuất----")*@
                    @Html.ValidationMessageFor(model => model.Model.ManufacturerId)
                   
                </p>                
                <p>
                    @* <p>
                        @Html.LabelFor(m => m.Manufacturer.Id)
                        @Html.DropDownListFor(m => m.Manufacturer.Id, new SelectList(Model.Manufacturer, "Id", "Name"), new { @class = "medium-input" })
                    </p>*@
                   
                </p>
                <p>
                    Thiết bị :
                    @Html.DropDownListFor(m => m.Model.DeviceId, (IEnumerable<SelectListItem>)(ViewBag.Device), new { id = "DeviceId" })                  
                    @Html.ValidationMessageFor(model => model.Model.DeviceId)
                </p>
                
                <div class="editor-label">
                    Hình đại diện
                </div>
                 <form action="@Url.Action("CreateModelCategory", "ManageCategories")" class="t-grid-actions" method="post">
                     <div class="editor-field">
                    <input id="edit-picture-upload" type="file" style="height: 25px"
                           name="file" />
                </div>  
                </form>
                       
                <p class="buttons">
                    @Html.Partial("_SaveButton")
                    @Html.Partial("_CancelButton", new ORM.Models.ActionInfo("Cancel", "ManageModelCategories"))
                </p>
            </div>
             if (ViewBag.UploadImageError != null)
       {
           <script type="text/javascript">
               if (ViewBag.UploadImageError != null) {
                   alert(ViewBag.UploadImageError);
               }
           </script>
       }
        }
    </div>
</div>
